﻿/*
 * Replace submit button.
 */
function submitting() {
    //$('.doing').remove();

    //content = $(".content");
    //str = "<table class='doing' width='980px' align='center'><tr><td align='right'>";
    //str +="<span class='submiting'>正在提交...</span></td></tr></table>";
    //content.before(str);
    
    return true;
}

/*
 * Check on or off all checkbox.
 */
function checkAll(checked) {
    $("input[@type=checkbox]").attr('checked', checked);
}

/*
 * Menu function.
 */
num = 0;

function findPosX(obj){
    var left = 0;

    if (obj.offsetParent) {
        while (obj.offsetParent) {
            left += obj.offsetLeft
            obj = obj.offsetParent;
        }
    }
    else if (obj.x) {
        left += obj.x;
    }

    return left;
}

function findPosY(obj){
    var top = 0;

    if (obj.offsetParent) {
        while (obj.offsetParent) {
            top += obj.offsetTop
            obj = obj.offsetParent;
        }
    }
    else if (obj.y) {
        top += obj.y;
    }

    return top;
}

function show_menu(ids,obj){
	mobj = document.getElementById(ids);

	try{mobj.style.left=document.body.offsetLeft+findPosX(obj)+'px';}catch(e){}
	try{mobj.style.top=document.body.offsetTop+findPosY(obj)+obj.offsetHeight+'px';}catch(e){}
	try{document.getElementById("category").style.visibility='hidden';}catch(e){}
	try{mobj.style.visibility='visible'}catch(e){}

	num += 1;
}

function out(i){
	num += i;
	setTimeout("close_menu();",200);
}

function close_menu(){
	if(num <= 0){
		mobj=document.getElementById('menu');
		try{document.getElementById("category").style.visibility='visible';}catch(e){}
		try{mobj.style.visibility='hidden';}catch(e){}
	}
}